﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;

namespace NFit.Core.Utils
{
    class Performances
    {
        public static void Measure(ILog logger, string textFormat, Action act)
        {
            long time = Measure(act);
            logger.Debug(string.Format(textFormat, time));
        }

        public static long Measure(Action act)
        {
            StopWatch sw = new StopWatch();
            sw.Reset();
            act();
            return sw.Peek() / 10;
        }
    }
}
